package main

import (
	proto "com/hr/go-muke/grpc/protobuf"
	"context"
	"fmt"
	"google.golang.org/grpc"
	"net"
)

/**
 * @Description
 * @Author huran
 * @Date
 * @Param
 * @return
 **/
type Server struct {
	proto.HelloServer
}

func (s *Server) Hello(ctx context.Context, in *proto.HelloRequest) (*proto.HelloResponse, error) {
	return &proto.HelloResponse{Reply: "回复"}, nil
}
func main() {

	g := grpc.NewServer()
	proto.RegisterHelloServer(g, &Server{})
	listen, err := net.Listen("tcp", "0.0.0.0:9999")
	fmt.Println("aaaaaaaaaaa")
	// 内部会用协程处理
	err = g.Serve(listen)
	if err != nil {
		panic("grpc failed err")
	}
}
